var mail = require('nodemailer');

var transport = mail.createTransport("SMTP", {
        host: 'smtp.gmail.com',
        port: 465,
        secureConnection: true,
        auth: {
                user: 'smeict@gmail.com',
                pass: 'tmakxmsme'
        }
});

console.log('SMTP Configured');

var message = {
        from: 'Sender Name <smeict@gmail.com>',
        to: '"Receiver Name" <muchine98@gmail.com>',
        subject: 'Nodemailer test.',
        headers: {
                'X-laziness-level': 1000
        },
        text: 'Hello Nodemailer',
        html:'<p><b>Hello</b> World</p>'
};

console.log('Sending mail');
transport.sendMail(message, function(error) {
        if (error) {
                console.log('Error occured');
                console.log(error.message);
                return;
        }
        console.log('Message sent successfully!');

        process.exit();
});
